<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:oc="http://java.sun.com/jsf/composite/owncomponents"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">

			<h:form id="userSettings" styleClass="horizontal_full">

				<h1>Own Settings</h1>
				
				<p>
					Here it is possible to change your company name and your email contacts.
					It is also possible to overwrite your existing login-password.
				</p>

				<h:panelGrid id="userConfig" columns="4" rowClasses="height50">
					<h:outputText value="Nickname"></h:outputText>
					<p:inputText id="name" value="#{userMBean.userName}"
						required="true" />
					<p></p>
					<oc:fieldhelp helptext="Nickname of the user/company" show="true" />

					<h:outputText value="Mails"></h:outputText>
					<p:inputTextarea id="mails" rows="5" cols="30" counter="display" value="#{userMBean.userMail}" maxlength="500" counterTemplate="{0} characters remaining." autoResize="false" required="false"/>
    				<h:outputText id="display" />
					<oc:fieldhelp helptext="Email address for the User/Company" show="true"/>

				</h:panelGrid>

				<h:panelGrid columns="2">
					<h:outputText value="Set password " />
					<p:selectBooleanCheckbox value="#{userMBean.setPassword}">
						<p:ajax event="change" update=":userSettings" />
					</p:selectBooleanCheckbox>
				</h:panelGrid>

				<h:panelGrid id="passwordPanel" columns="4" rowClasses="height50"
					rendered="#{userMBean.setPassword}">
					<h:outputLabel for="pwd1" value="Password" />
					<p:password id="pwd1" value="#{userMBean.userPassword}"
						match="pwd2" label="Password 1" required="true" />
					<p></p>
					<oc:fieldhelp
						helptext="Password for the user/company for the login" show="true" />

					<h:outputLabel for="pwd2" value="Repeat password" />
					<p:password id="pwd2" value="#{userMBean.userPassword}"
						label="Password 2" required="true" />
					<p></p>
					<oc:fieldhelp
						helptext="Password for the user/company for the login" show="true" />
				</h:panelGrid>

				<h:panelGrid columns="2">
					<p:commandButton action="#{userMBean.actionUpdateUser()}"
						id="saveButton" value="Save" update=":messages"
						icon="ui-icon-disk" title="Icon Only" />
					<p:commandButton action="#{userMBean.actionGotoUserMainPage()}"
						id="abortButton" value="Abort" update=":messages"
						icon="ui-icon-circle-close" title="Icon Only" immediate="true" />
				</h:panelGrid>
			</h:form>

		</ui:define>
	</ui:composition>
</h:body>
</html>